package schema;

import java.io.IOException;
import java.util.Properties;

public class Environment {

	private static Properties prop = new Properties();

	static {
		try {
			prop.load(Thread.currentThread().getContextClassLoader().getResourceAsStream("apps.properties"));
		} catch (IOException e) {
			e.printStackTrace();
		}
	}

	public static ClassLoader getDefaultClassLoader() {
		ClassLoader cl = null;
		try {
			cl = Thread.currentThread().getContextClassLoader();
		} catch (Throwable ex) {
			// Cannot access thread context ClassLoader - falling back to system
			// class loader...
		}
		if (cl == null) {
			// No thread context class loader -> use class loader of this class.
			cl = Environment.class.getClassLoader();
		}
		return cl;
	}

	public static boolean isDev() {
		return Boolean.valueOf((String) prop.get("dev"));
	}

	public static String getConfXml() {
		return (String) prop.getProperty("conf");
	}
}
